package com.ideyatech.allowancereceipts.entity;

import java.util.List;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hightides.annotations.Controller;
import org.hightides.annotations.Dao;
import org.hightides.annotations.Page;
import org.hightides.annotations.Service;
import org.hightides.annotations.TextField;
import org.opentides.bean.BaseCriteria;
import org.opentides.bean.BaseSortableEntity;

@Dao
@Service
@Controller
@Page
@Entity
@Table(name = "EMPLOYEE")
public class Employee extends BaseSortableEntity implements BaseCriteria {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4815467894612275924L;

	@Basic(optional = false)
	@Column(name = "EMP_ID", unique = true)
	@TextField(requiredField = true, label = "Employee ID", listed = true)
	private String employeeID;

	@Basic(optional = false)
	@Column(name = "FIRST_NAME", length = 512)
	@TextField(requiredField = true, label = "First Name", listed = true)
	private String firstName;
	
	@Basic(optional = true)
	@Column(name = "MIDDLE_NAME", length = 512)
	@TextField(requiredField = false, label = "Middle Name", listed = true)
	private String middleName;

	@Basic(optional = false)
	@Column(name = "LAST_NAME", length = 512)
	@TextField(requiredField = true, label = "Last Name", listed = true)
	private String lastName;
	
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
	private List<Receipt> receipts;

	public String getEmployeeID() {
		return employeeID;
	}

	public void setEmployeeID(String employeeID) {
		this.employeeID = employeeID;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getMiddleName() {
		return middleName;
	}

	public void setMiddleName(String middleName) {
		this.middleName = middleName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	
	public List<Receipt> getReceipts() {
		return receipts;
	}

}
